<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.partner.prepay.role.form.Menu"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>主菜单</title>
		<%@ include file="/easyprepay/jsp/common/head.jsp"%>
		<%@ taglib uri="/easyprepay" prefix="easy"%>
		<script type="text/javascript">
			function addMenu(){
				location.href="<%=basePath%>easyprepay/jsp/role/addMenu.jsp";
			}
			function delMenu(menuId,menuName){
				if (confirm("您确定要删除"+" "+menuName+"?")){
				
				location.href="<%=basePath%>userRole.do?method=delMenu&menuId="+menuId;
			}else{
				
			}
				
			}
			function getChildMenu(menuId,menuName){
				location.href="<%=basePath%>userRole.do?method=getChildMenu&menuId="+menuId+"&menuName="+menuName;
			}
		</script>

	</head>

	<body>
		主菜单设置
		<hr>
		<table border=1 width=100%>
			<tr>
				<td>
					编号
				</td>
				<td>
					主菜单名称
				</td>
				<td colspan="2">
					主菜单设置
				</td>
			</tr>
			<%
				//获取主菜单集合
				List<Menu> allMenu = (List<Menu>) request.getAttribute("allMenu");
				int s = allMenu.size();
				for (int i = 0; i < s; i++) {
			%>
			<tr>
				<td><%=i + 1%></td>
				<td><%=allMenu.get(i).getMenuName()%></td>
				<td>
					<input type="button" value="编辑菜单"
						onclick='getChildMenu("<%=allMenu.get(i).getId()%>","<%=allMenu.get(i).getMenuName()%>")'>
				</td>
				<td>
					<input type="button" value="删除主菜单"
						onclick='delMenu("<%=allMenu.get(i).getId()%>","<%=allMenu.get(i).getMenuName()%>")'>
				</td>
			</tr>
			<%
				}
			%>
			<tr>
				<td colspan="4" align="right">
					<input type="button" value="添加主菜单" onclick="addMenu()">
				</td>
		</table>
	</body>
</html>
